﻿ <%--
 *  File:   BusinessInfoBuyStockData.jsp
 *  Desc:	the Lend slip summary page
 *
 *  Date		  Author		   Changes
 *  2012-3-16	  zahirzhong		  Created
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ page contentType = "text/html;charset=UTF-8" %>
<%
  //init param
  String privilegeCode = "R70010";
  String strTableName = "v_zylzylterminalreport1";
  String strModuleName = "COM";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/rpt/ReportURL.inc" %>

<html>
<head>
<title>360Report.jsp</title>
<PageFlow:CheckPageFlow pageName="p_zylzylterminalreport"/>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>

<%
HashMap userinfo = (HashMap)session.getAttribute("userinfo");
Integer  issalesman =new Integer(-1);
if(userinfo.get("issalesman") != null){
  issalesman= (Integer) userinfo.get("issalesman");
}
String  username = (String) userinfo.get("employeename");
String flag = (String)pageContext.getAttribute("flag");
java.util.Calendar cal = java.util.Calendar.getInstance();   
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript">
var popwindow;
function page_summary(actionvalue,orderbyname)
{ 
var reporttype = document.cform.reporttype.value;          
var month = document.cform.months.value;
 if (reporttype == 2){
var n_monstr=0;
 if(month==1||month==4||month==7||month==10) 
 {
 	n_monstr=month;
 	}
 if (month==2){
 n_monstr="1,2";
 }
 if (month==3){
 n_monstr="1,2,3";
 }
 if (month==5){
 n_monstr="4,5";
 }
 if (month==6){
 n_monstr="4,5,6";
 }
  if (month==8){
 n_monstr="7,8";
 }
  if (month==9){
 n_monstr="7,8,9";
 }
  if (month==11){
 n_monstr="10,11";
 }
 if (month==12){
 n_monstr="10,11,12";
 }
 }
 if (reporttype == 3){
  var n_monstr=1;
 	
 if (month!=1){
  var cnt= month;
  for (var j=1;j<cnt;j++){
  var i=j+1;
 n_monstr=n_monstr+","+i;
 	}
 	}

 }
 if (reporttype == 4){

 		var n_monstr=1;
 

  var cnt= 12;
  for (var j=1;j<cnt;j++){
  var i=j+1;
 n_monstr=n_monstr+","+i;
}
 }
 document.cform.monthstr.value=n_monstr;
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "zylTerminal306Report.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
function clickRow(obj,idx)
{
  var cform = document.cform;
  cform.radiorow[idx].checked=true;
  cform.year.value = eval('obj.all.year'+idx).value;
  cform.month.value = eval('obj.all.month'+idx).value;
}
function popRep() {
	var regionid=cform.regionid.value;
	var proviceofficecode = document.cform.proviceofficelist.value;
	var businessareacode = document.cform.businessarealist.value;
	var status = "height=400, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	var url = "<%=contextPath%>/tdr/dataverify/SalesPopWindow.jsp?<%= OvalTools.randomURL() %>&regionid="+regionid+"&proviceofficecode="+proviceofficecode+"&businessareacode="+businessareacode;
    popwindow = window.open(url, "newwindow", status);
}
function SetSalesMan(id,code,name){
	cform.userids.value=id;
	cform.employeecode.value=code;
	cform.employeename.value=name;
}
function page_getpriviceoffice(){
	var objdeptcode=eval("cform.regionid");
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , objdeptcode.value , "Integer");
	datahandler.getResultFromVector("resultproviceoffice","proviceofficename","proviceofficecode","document.cform.proviceofficelist");
	datahandler.add_job("j_zylbusinessareainfobuystock");
	datahandler.runDataHandler();
}
function page_getbusinessarea(){
	var objdeptcode=eval("cform.proviceofficelist");
	var regionid = document.cform.regionid.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , regionid , "Integer");
	datahandler.add_params("proviceofficelist" , objdeptcode.value , "String");
	datahandler.getResultFromVector("resultbusinessarea","businessareaname","businessareacode","document.cform.businessarealist");
	datahandler.add_job("j_zylbusinessareainfobuystock");
	datahandler.runDataHandler();
}

function page_excel(){

	var id = document.cform.userid.value;	
	var year = document.cform.years.value;
	var month = document.cform.months.value;
    var orgregioncode = document.cform.orgregioncode.value;
	var deptid = document.cform.deptid.value;
	var hospitaltype = document.cform.hospitaltype.value;
	var hospitalgrade = document.cform.hospitalgrade.value;
	var pharmacylevel = document.cform.pharmacylevel.value;
	var chaintype = document.cform.chaintype.value;
	var reporttype = document.cform.reporttype.value;
 
	var prodid = document.cform.prodid.value;

	 if (reporttype == 1){
	<%if(issalesman.intValue()!= 1){%>
	var userids =document.cform.userids.value;
	var areaids =document.cform.areaids.value;
 	window.open("<%= reportURL %>/servlet/ExcecuteReport/month360report.sox?__folder=/ovalreport&rownum=2&employeeid="+ id+"&employeeids="+userids+"&n_year="+year+"&n_month="+month+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype+"&areaids="+areaids);
	<% }else{  %>
	
	var salesman =document.cform.userid.value;
 	window.open("<%= reportURL %>/servlet/ExcecuteReport/month360report.sox?__folder=/ovalreport&rownum=2&employeeid="+ id+"&n_year="+year+"&n_month="+month+"&salesman="+salesman+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);	
 	<% }%>
 	}
 	
if (reporttype == 2){
 	var n_monstr=0;
 if(month==1||month==4||month==7||month==10) {
 	n_monstr=month;
 }
 if (month==2){
 n_monstr="1,2";
 }
 if (month==3){
 n_monstr="1,2,3";
 }
 if (month==5){
 n_monstr="4,5";
 }
 if (month==6){
 n_monstr="4,5,6";
 }
  if (month==8){
 n_monstr="7,8";
 }
  if (month==9){
 n_monstr="7,8,9";
 }
  if (month==11){
 n_monstr="10,11";
 }
 if (month==12){
 n_monstr="10,11,12";
 }
	<%if(issalesman.intValue()!= 1){%>
	var userids =document.cform.userids.value;
	var areaids =document.cform.areaids.value;
	window.open("<%= reportURL %>/servlet/ExcecuteReport/quarter360report.sox?__folder=/ovalreport&rownum=2&employeeid="+ id+"&areaids="+areaids+"&employeeids="+userids+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);
	<% }else{  %>
		var salesman =document.cform.userid.value;
 	    window.open("<%= reportURL %>/servlet/ExcecuteReport/quarter360report.sox?__folder=/ovalreport&rownum=2&employeeid="+ id+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&salesman="+salesman+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);
 	<% }%>
 	}
 if (reporttype == 3){

 	var n_monstr=1;
 	if(month==1) {
 	n_monstr=month;
 	}
 if (month!=1){
  var cnt= month;
  for (var j=1;j<cnt;j++){
  var i=j+1;
 n_monstr=n_monstr+","+i;

 }
 }
	<%if(issalesman.intValue()!= 1){%>
	var userids =document.cform.userids.value;
	var areaids =document.cform.areaids.value;
 	window.open("<%= reportURL %>/servlet/ExcecuteReport/ytd360report.sox?__folder=/ovalreport&rownum=2&employeeid="+ id+"&areaids="+areaids+"&employeeids="+userids+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);
	<% }else{  %>
	var salesman =document.cform.userid.value;
 	window.open("<%= reportURL %>/servlet/ExcecuteReport/ytd360report.sox?__folder=/ovalreport&rownum=2&employeeid="+ id+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&salesman="+salesman+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);	
 	<% }%>
 	}
 	if (reporttype == 4){

 		var n_monstr=1;
 	
 
  var cnt= 12;
  for (var j=1;j<cnt;j++){
  var i=j+1;
 n_monstr=n_monstr+","+i;

 }
	<%if(issalesman.intValue()!= 1){%>
	var areaids =document.cform.areaids.value;
	var userids =document.cform.userids.value;
 	window.open("<%= reportURL %>/servlet/ExcecuteReport/year360report.sox?__folder=/ovalreport&rownum=2&employeeid="+ id+"&areaids="+areaids+"&employeeids="+userids+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);
	<% }else{  %>
	var salesman =document.cform.userid.value;
 	window.open("<%= reportURL %>/servlet/ExcecuteReport/year360report.sox?__folder=/ovalreport&rownum=2&employeeid="+ id+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&salesman="+salesman+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);
 	<% }%>
}
}
function page_csv(){
	var id = document.cform.userid.value;	
	var year =document.cform.years.value;
	var month =document.cform.months.value;
	var orgregioncode = document.cform.orgregioncode.value;
	var deptid = document.cform.deptid.value;
	var hospitaltype = document.cform.hospitaltype.value;
	var hospitalgrade = document.cform.hospitalgrade.value;
	var pharmacylevel = document.cform.pharmacylevel.value;
	var chaintype = document.cform.chaintype.value;
	
	//var searchname = document.cform.searchname.value;
	//var searchvalue = document.cform.searchvalue.value;
	//if(searchvalue=="" || searchvalue==null)searchvalue=-1;
	var reporttype = document.cform.reporttype.value;
 
	var prodid = document.cform.prodid.value;
	
	 if (reporttype == 1){
  
    <%if(issalesman.intValue()!= 1){%>
    var areaids =document.cform.areaids.value;
	var userids =document.cform.userids.value;
    window.open("<%= reportURL %>/csv?__report=/ovalreport/month360report.txt&employeeid="+ id+"&areaids="+areaids+"&employeeids="+userids+"&n_year="+year+"&n_month="+month+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);
	<% }else{  %>
	var salesman =document.cform.userid.value;
 	window.open("<%= reportURL %>/csv?__report=/ovalreport/month360report.txt&employeeid="+ id+"&n_year="+year+"&n_month="+month+"&salesman="+salesman+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);	
 	<% }%>
 	
 	}
if (reporttype == 2){
 var n_monstr=0;
 if(month==1||month==4||month==7||month==10) {
 n_monstr=month;
 }
 if (month==2){
 n_monstr="1,2";
 }
 if (month==3){
 n_monstr="1,2,3";
 }
 if (month==5){
 n_monstr="4,5";
 }
 if (month==6){
 n_monstr="4,5,6";
 }
  if (month==8){
 n_monstr="7,8";
 }
  if (month==9){
 n_monstr="7,8,9";
 }
  if (month==11){
 n_monstr="10,11";
 }
 if (month==12){
 n_monstr="10,11,12";
 }
	<%if(issalesman.intValue()!= 1){%>
	var areaids =document.cform.areaids.value;
	var userids =document.cform.userids.value;
 	window.open("<%= reportURL %>/csv?__report=/ovalreport/quarter360report.txt&employeeid="+ id+"&areaids="+areaids+"&employeeids="+userids+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);
	<% }else{  %>
	var salesman =document.cform.userid.value;
 	window.open("<%= reportURL %>/csv?__report=/ovalreport/quarter360report.txt&employeeid="+ id+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&salesman="+salesman+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);	
 	<% }%>
 	}
if (reporttype == 3){

 		var n_monstr=1;
 	if(month==1) {
 	n_monstr=month;
 	}
 if (month!=1){
  var cnt= month;
  for (var j=1;j<cnt;j++){
  var i=j+1;
 n_monstr=n_monstr+","+i;

 }
 }
	<%if(issalesman.intValue()!= 1){%>
	var areaids =document.cform.areaids.value;
	var userids =document.cform.userids.value;
 	window.open("<%= reportURL %>/csv?__report=/ovalreport/ytd360report.txt&employeeid="+ id+"&areaids="+areaids+"&employeeids="+userids+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);
	<% }else{  %>
	var salesman =document.cform.userid.value;
 	window.open("<%= reportURL %>/csv?__report=/ovalreport/ytd360report.txt&employeeid="+ id+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&salesman="+salesman+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);	
 	<% }%>
 	}
if (reporttype == 4){

  var n_monstr=1;
  var cnt= 12;
  for (var j=1;j<cnt;j++){
  var i=j+1;
 n_monstr=n_monstr+","+i;

 }
	<%if(issalesman.intValue()!= 1){%>
	var userids =document.cform.userids.value;
	var areaids =document.cform.areaids.value;
 	window.open("<%= reportURL %>/csv?__report=/ovalreport/year360report.txt&employeeid="+ id+"&areaids="+areaids+"&employeeids="+userids+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);	
	<% }else{  %>
	
	var salesman =document.cform.userid.value;
 	window.open("<%= reportURL %>/csv?__report=/ovalreport/year360report.txt&employeeid="+ id+"&n_year="+year+"&n_month="+month+"&n_monthstr="+n_monstr+"&salesman="+salesman+"&prodid="+prodid+"&orgregioncode="+orgregioncode+"&deptid="+deptid+"&hospitaltype="+hospitaltype+"&hospitalgrade="+hospitalgrade+"&pharmacylevel="+pharmacylevel+"&chaintype="+chaintype);	
 	<% }%>
 	}
}
function checkBoxSeleceed(){
	var obj =document.getElementsByName("deleteids");
	var objLen = obj.length;
	var j=0;
	var m=0;
	for (j==0;j<objLen;j++){
       if(obj[j].checked==true){
           m++;
       }
	}
	return m;
}
function page_clear(){
	/*
	document.cform.regionid.value="";
	document.cform.proviceofficelist.value="";
	document.cform.businessarealist.value="";
	*/
	document.cform.employeename.value="";
	document.cform.userids.value="";
	
}
function page_clear2(){
	document.cform.orgregioncode.value="";
	document.cform.newsregionname.value="";

	
}
function page_clear3(){
	document.cform.productname.value="";
	document.cform.prodid.value="";
}
function page_clear3(){
	document.cform.areaids.value="";
	document.cform.businessareanames.value="";
}
 
var type;




function page_setRegion(code,name)
{
  
  document.cform.orgregioncode.value = code;
  document.cform.newsregionname.value = name;
  if (popwindow != null)
    popwindow.close();
}
function page_selectProvince()
{
  if(popwindow!=null)
    popwindow.close();
  popwindow = window.open('<%=contextPath %>/masterdata/ogm/RegionSelect.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN','newwindow', 'height=250, width=500,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
}


function page_selectProd() {
		var status = "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
		var url = "<%=contextPath%>/phap/phap.datp/masterdata/kdm/ProductSelect.jsp?o_thread=" + Math.random();
			
		if (typeof popwindow != 'undefined') popwindow.close();
		popwindow = window.open(url, "newwindow", status);
	}

function page_setproduct(id,umcode,prodcode,prodname){
		document.cform.prodid.value=id;
		document.cform.productname.value=prodname;
	}	
function popRep() {
	//var regionid=cform.regionid.value;
	//var proviceofficecode = document.cform.proviceofficelist.value;
	//var businessareacode = document.cform.businessarealist.value;
	var status = "height=400, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	var url = "<%=contextPath%>/tdr/dataverify/SalesPopWindow.jsp?<%= OvalTools.randomURL() %>";
  
	popwindow = window.open(url, "newwindow", status);
  }

function SetSalesMan(id,code,name){
	cform.userids.value=id;
	cform.employeecode.value=code;
	cform.employeename.value=name;
}	

function page_getpriviceoffice(){
	var objdeptcode=eval("cform.regionid");
	var style = document.cform.style.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("style" , style, 'Integer');
	datahandler.add_params("regionid" , objdeptcode.value , "Integer");
	datahandler.getResultFromVector("resultproviceoffice","proviceofficename","proviceofficecode","document.cform.proviceofficelist");
	datahandler.add_job("j_zylhospitalbuysalesstockbytime");
	datahandler.runDataHandler();
  }
function page_getbusinessarea(){
	var objdeptcode=eval("cform.proviceofficelist");
	var regionid = document.cform.regionid.value;
	var style = document.cform.style.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("style" , style, 'Integer');
	datahandler.add_params("regionid" , regionid , "Integer");
	datahandler.add_params("proviceofficelist" , objdeptcode.value , "String");
	datahandler.getResultFromVector("resultbusinessarea","businessareaname","businessareacode","document.cform.businessarealist");
	datahandler.add_job("j_zylhospitalbuysalesstockbytime");
	datahandler.runDataHandler();
 }  
	function popOrgnization(){
	if(popwindow!=null) popwindow.close();
    var globalpccodestr = '114,113';
    url = "<%=contextPath %>/masterdata/ogm/OrgSelect.jsp?<%= OvalTools.randomURL() %>&globalpccodestr=114,113";
    attribute = 'height=450, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
function  page_setOrg(id,orgname,orgcode,selectshortname){
   
    document.cform.orgid.value=id;
		document.cform.orgname.value=orgname;
}

function  page_dismonth(){
var reporttype = document.cform.reporttype.value;
if (reporttype==4){
document.getElementById("months").style.display="none";
}
else {
document.getElementById("months").style.display="block";
}
}
function popBusinessarea_moulty(){
	if(popwindow!=null) popwindow.close();
	
    url = '<%=contextPath %>/zyl/masterdata/map/SelectAreaTree.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=540, width=250,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';
	popwindow = window.open(url,'newwindow', attribute);
}
function setAreas(areaids,areanames,areacodes){

	document.cform.areaids.value = areaids;
	document.cform.businessareanames.value = areanames;
	//document.cform.businessareacode.value = areacodes;
} 
</script>


<style type="text/css">
*{padding:0;margin:0;}
.container {width:230px;margin:1px auto;}
.holder2 {color:#FDFAC5;}
/*wu tu yuan jiao*/
.b1 {height:1px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; margin:0 5px;background-color:#FDFAC5}
.b2 {height:1px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; border-right:2px solid #FDFAC5; border-left:2px solid #FDFAC5; margin:0 3px;background-color:#FDFAC5}
.b3 {height:1px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; border-right:1px solid #FDFAC5; border-left:1px solid #FDFAC5; margin:0 2px;background-color:#FDFAC5}
.b4 {height:2px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; border-right:1px solid #FDFAC5; border-left:1px solid #FDFAC5; margin:0 1px;background-color:#FDFAC5}
.content {border-right:1px solid #FDFAC5; height:15px;border-left:1px solid #FDFAC5;background-color:#FDFAC5}
</style>

</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_zylzylterminalreport"/>
    <input type="hidden" name="actionname"/>
    <input type="hidden" name="monthstr"/>
    <input type="hidden" name="hflag1"/>
    <input type="hidden" name="dflag2"/>
    <input type="hidden" name="mark" value="1"/>
<custom:hidden property="userid" name="userinfo" scope="session"></custom:hidden>
<%--  page location   --%>
    <%@ include file="/inc/PageLocation.inc" %>
<custom:hidden property="globalpccode"></custom:hidden>
    <table width="100%" cellspacing="0" border="0" cellpadding="0">
      <tr>
<%--  search criteria  --%>
      </tr>
      <tr>
        <td>
          <table width="100%" border="0" cellspacing="0">
           <tr>
          <td class="summary_top" width="10%" colspan="3"></td>
          </tr>
          
          </table>
        </td>
      </tr>
      	<tr>
        <td>
  <table width="100%" border="0" cellspacing="0" >
  <tr>
                <%
                    String year = cal.get(Calendar.YEAR)+"";     
					String month = cal.get(Calendar.MONTH)+"";
					if(cal.get(Calendar.MONTH) == 0){
						month = "12";
						year = (cal.get(Calendar.YEAR)-1)+"";
						if("first".equals(flag)){ 
					}  
				%>
                <td class="td_right"><%=label.getLabelName("L_ReportType") +  label.getLabelName("L_Colon") %></td>
	        	<td class="td_left"><custom:selectdic property="reporttype" dictType="360ReportType" command="notnull" value="1" label="L_ReportType" onchange="page_dismonth();"/></td>
	        	<td class="td_right"><%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %></td>
	        	<td class="td_left"><custom:selectdic property="years" dictType="Years" command="notnull" value="<%=year %>" label="L_Year1"/></td>
	        	<td class="td_right"><%=label.getLabelName("L_Month") +  label.getLabelName("L_Colon") %></td>
	        	<td class="td_left"><custom:selectdic property="months" dictType="Months" command="notnull" value="<%=month %>" label="L_Month"/></td>
     	<%}else{ %>
     	 <td class="td_right"><%=label.getLabelName("L_ReportType") +  label.getLabelName("L_Colon") %></td>
	        	<td class="td_left"><custom:selectdic property="reporttype" dictType="360ReportType" command="notnull" label="L_ReportType" onchange="page_dismonth();"/></td>
     		    <td class="td_right"><%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %></td>
	        	<td class="td_left"><custom:selectdic property="years" dictType="Years" command="notnull"  label="L_Year1"/></td>
	        	<td class="td_right"><%=label.getLabelName("L_Month") +  label.getLabelName("L_Colon") %></td>
	        	<td class="td_left"><custom:selectdic property="months" dictType="Months" command="notnull"  label="L_Month"/></td>
        <%  }%>
	        <tr> 

		      <td class="td_right"><%=label.getLabelName("L_ProductBusiness") +  label.getLabelName("L_Colon") %></td>
			  <td class="td_left"><custom:select property="deptid" optionInnerTextKey="deptname" optionsName="alldeptnames" optionValueKey="deptid" defaultValue="----------" style="width:150px" defaultValueCost="" /></td>
              <td class="td_right"><%=label.getLabelName("L_Hospital") + label.getLabelName("L_FileType") + label.getLabelName("L_Colon") %></td>
			  <td class="td_left"><custom:selectdic dictType="HospitalType" property="hospitaltype"   defaultValueCost="" defaultValue="-----------"/></td>
			  <td class="td_right"><%= label.getLabelName("L_Hospital") +  label.getLabelName("L_Grade") + label.getLabelName("L_Colon") %></td>                
			  <td class="td_left"><custom:selectdic dictType="YLHospitalLevel" property="hospitalgrade" defaultValue="-------------"  defaultValueCost="" /></td>
           <tr>
              <td class="td_right">医院/药店名称<%= label.getLabelName("L_Colon") %></td>
              <td class="td_left"><custom:text property="orgname"  readonly="true" size="20"/>
              <a onclick="popOrgnization()"><custom:button type="3" label="" value="*"/></a>
              <custom:hidden property="orgid" /></td>
              <td class="td_right"><%= label.getLabelName("L_PharmacyType") + label.getLabelName("L_Colon") %></td>
          	  <td class="td_left"><custom:selectdic property="chaintype"  dictType="ChainType" defaultValue="-----"  label="L_PharmacyType"  defaultValueCost=""></custom:selectdic></td>
              <td class="td_right"><%= label.getLabelName("L_DrugstoreLevel") + label.getLabelName("L_Colon") %></td>
              <td class="td_left"><custom:selectdic dictType="PharmacyLevel"   property="pharmacylevel"  label="L_PharmacyLevel" defaultValue="-----" defaultValueCost=""/></td>
        	</tr>
        	<tr>
        	    <!--
        	    <td class="td_right"><%=label.getLabelName("L_Businessarea") +  label.getLabelName("L_Colon") %></td>
        	  	<td class="td_left"><custom:select property="regionid" optionInnerTextKey="regionname" style="width:160px" optionsName="resultregion" optionValueKey="regionid" onchange="page_getpriviceoffice()" defaultValue="ALL" defaultValueCost=""/></td>
        	    <td class="td_right"><%=label.getLabelName("L_Provicetdr") +  label.getLabelName("L_Colon") %></td>
				<td class="td_left">
					<custom:select property="proviceofficelist" optionInnerTextKey="proviceofficename" optionsName="resultproviceoffice" optionValueKey="proviceofficecode" defaultValue="----------" style="width:150px" defaultValueCost="" onchange="page_getbusinessarea();"/>
		        </td>
			    <td class="td_right"><%=label.getLabelName("L_RegionOffice") +  label.getLabelName("L_Colon") %></td>
				<td class="td_left">
				<custom:select property="businessarealist" optionInnerTextKey="businessareaname" optionsName="resultbusinessarea" optionValueKey="businessareacode" defaultValue="----------" style="width:180px" defaultValueCost=""/> </td>
        	     -->
        	    <td class="td_right"><%= label.getLabelName("L_ProdName") + label.getLabelName("L_Colon") %></td>
         	    <td class="td_left"><custom:text property="productname" readonly="true" size="20"/>&nbsp;<a onclick="javascript:page_selectProd();"><custom:button type="3"  label="" value="*"/></a><custom:hidden property="prodid" />
                <button type="button" onclick="page_clear3()" class="button1" name="re" value="clear"><%=label.getLabelName("L_Clear") %></button></td>
        	    <td class="td_right"><%= label.getLabelName(" L_Province") + label.getLabelName("L_Colon") %></td>
                <td class="td_left">
                <custom:text property="newsregionname" size="20" readonly="true"/>&nbsp;
                <custom:hidden property="orgregioncode"/>
                <a onclick="javascript:page_selectProvince();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
                <button type="button" onclick="page_clear2()" class="button1" name="re" value="clear"><%=label.getLabelName("L_Clear") %></button></td>
        	    <%if(issalesman.intValue()!= 1){%>
        	    <td class="td_right"><%=label.getLabelName("L_BusinessContact") +  label.getLabelName("L_Colon") %></td>
				<td class="td_left">
				<custom:text property="employeename" size="20" readonly="true" style="border:1px #7F9DB9 solid;"/>
				<a onClick="javascript:popRep();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a> 
				<custom:hidden property="userids"/>
				<custom:hidden property="employeecode"/><button type="button" onclick="page_clear()" class="button1" name="re" value="clear"><%=label.getLabelName("L_Clear") %></button>
		        </td>
        	    <td  class="td_right"><%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %></td>
			    <td class="td_left"><custom:hidden  property="areaids" />
					<custom:text  property="businessareanames" size="20" label="L_BusinessAreaName" readonly="true"/>&nbsp;<a onclick="popBusinessarea_moulty()"><custom:button type="3" value="*"/></a>
					<button type="button" onclick="page_clear4()" class="button1" name="re" value="clear"><%=label.getLabelName("L_Clear") %></button>	
		            &nbsp;&nbsp;<a href="javascript:page_summary('search')"><img src="<%= ConstantProp.DEFAULT_ROOT_PATH %>/images/<%= strLanguageCode %>/ss.png" border="0" ></a>
		        </td>
		        <%} %>
        	</tr>
          </table>
        </td>
      </tr>
      <tr>
        <td>
        <div style="width:100%;height=320;overflow=auto;">
          <table width="180%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
			<tr class="deepblue-left">
				<td nowrap="nowrap">&nbsp;</td>
				<td nowrap="nowrap">大区/省区</td>
				<td nowrap="nowrap"><%=label.getLabelName("L_Province")%></td>
				<td nowrap="nowrap"><%=label.getLabelName("L_Department")%></td>
				<td nowrap="nowrap"><%=label.getLabelName("L_ProductBusiness")%></td>
				<td nowrap="nowrap"><%=label.getLabelName("L_RegionOffice")%></td>
				<td nowrap="nowrap"><%=label.getLabelName("L_employeenameDelegate")%></td>
				<td nowrap="nowrap"><%=label.getLabelName("L_City")%></td>
				<td nowrap="nowrap">区/县/县级市</td>
				<td nowrap="nowrap">医院/药店名称</td>
				<td nowrap="nowrap">医院/药店类型</td>
				<td nowrap="nowrap">医院/药店级别</td>
				<td nowrap="nowrap"><%=label.getLabelName("L_Departments")%></td>
				<td nowrap="nowrap"><%=label.getLabelName("L_ProdName")%></td>
<td nowrap="nowrap">目标</td>
                <td nowrap="nowrap"><%=label.getLabelName("L_Actual")%></td>
<td nowrap="nowrap">达成率</td>
<td nowrap="nowrap">差额</td>
<td nowrap="nowrap">同期</td>
<td nowrap="nowrap">同比增长</td>
<td nowrap="nowrap">上期</td>
<td nowrap="nowrap">环比增长</td>
			</tr>

 <%
     ArrayList detailTdArray = new ArrayList();
     detailTdArray.add(new RadioTD());
    // detailTdArray.add(new WriteTD("year"));
     //detailTdArray.add(new WriteTD("month"));
detailTdArray.add(new WriteTD("orgprarentareaname"));
detailTdArray.add(new WriteTD("orgregionname"));
detailTdArray.add(new WriteTD("orgareaname"));
detailTdArray.add(new WriteTD("deptname"));
detailTdArray.add(new WriteTD("orgprovinceareaname"));
detailTdArray.add(new WriteTD("orgrepname"));
detailTdArray.add(new WriteTD("orgcityname"));
detailTdArray.add(new WriteTD("orgcountyname"));
detailTdArray.add(new WriteTD("orgname"));
detailTdArray.add(new WriteTD("organalysisattr7"));
detailTdArray.add(new WriteTD("organalysisattr3"));
detailTdArray.add(new WriteTD("hospitaldeptname"));
detailTdArray.add(new WriteTD("prodname"));
detailTdArray.add(new WriteTD("sourceqty"));
detailTdArray.add(new WriteTD("qty"));
detailTdArray.add(new WriteTD("agreerate"));
detailTdArray.add(new WriteTD("differqty"));
detailTdArray.add(new WriteTD("sqty"));
detailTdArray.add(new WriteTD("speriod"));
detailTdArray.add(new WriteTD("lqty"));
detailTdArray.add(new WriteTD("chain"));
     
     
     ArrayList hiddenArray = new ArrayList();
     //hiddenArray.add(new HiddenInput("year",true));
     //hiddenArray.add(new HiddenInput("month",true));
 %>
    <custom:iteratetr tdArray="<%=detailTdArray%>" hiddenArray="<%=hiddenArray%>"  dataSource="totalsummary"/>
           <%@ include file="/inc/SummaryAction.inc" %>
          </table>
		  </div>
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
              	<a onclick="page_excel();"><custom:button type="1" label="L_ExcelE" imgsrc="Modify.gif" border="0" style="width:100" privilegeCode="MB-ZDSX01"/></a>&nbsp;&nbsp;
				<a onclick="page_csv();"><custom:button type="1" label="L_ExportCSV" imgsrc="Modify.gif" border="0" style="width:100" privilegeCode="MB-ZDSX02"/></a>&nbsp;&nbsp;
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
</form>
</body>

</html>

